<template>
  <div>
     <div>
    <el-row style="color:red">操作管理员【admin】</el-row>
  </div>
  <div>
      <el-row>
      <el-col :span="16" class="pt-7 ps-4 w-50">
          <el-input placeholder="请输入搜索内容" v-model="searchVal">
            <template #append>
              <el-button type="info" plain @click="getNoteLi"><el-icon><Search /></el-icon></el-button>
            </template>
          </el-input>
        </el-col>
      </el-row>
  </div>
  <div>
      <el-row>
          <el-col>
      <el-card v-for="(comment,) in comments" :key="comment.newsCommentId" class="mb-2">
          <el-row class="mb-1">
              <el-col :span="24">
                  {{comment.authorName}}
              </el-col>
          </el-row>
          <el-row class="mb-1">
              <el-col :span="18">{{comment.comContent}}</el-col>
              <el-col :span="4">
                  <el-button style="color:red" type="danger" ref="delTips" @click="del(news.newsId)">删除</el-button>
                  </el-col>
          </el-row>
      </el-card>
          </el-col>
      </el-row>
  </div>
  </div>
</template>

<script>
var Mock = require("mockjs");
import { Search } from "@element-plus/icons-vue";
//import {ElMessageBox} from "element-plus";
export default{
    name:"CommentAdmin",
      emits:['getSearchVal'],
    components: {
    Search,
    },
    props:{
        newsInfoId:Number,
    },
    data(){
       return{
        searchVal: null,
        comments:[],
           comment:{
                comcontent:null,
                newsInfoId:null,
                userId:null,
                commentId:null,
                comtime:null,
                replyAuthorId:0
            },
        };
    },
    mounted(){
       this.getcomments();
    },
   methods:{
//        async getComments(){
//             await this.$axios.get("/api/news/detail/comment/list"
//             ,this.newsInfoId).then((response)=>{
//                 let data = response.data;
//                 if(data.code == 200){
//                     this.comments=data.data;
//                 }
//             });
//         },
//            del(newsId){
//             ElMessageBox.confirm("是否删除这条评论？","警告",{
//                 confirmButtonText:"是", 
//                 cancelButtonText:"否", 
//                 type:"warning",
//             }).then(()=>{
//                 this.$axios.get("/api/news/detail/comment/list"+newsId).then((response)=>{
//                     let data = response.data;
//                     if(data.code == 200){
//                         alert(data.msg);
//                         this.getNoteList();
//                     }
//                 });
//             });
//         },
//     //按下搜索按钮时，触发该函数
//    getNoteLi() {
//      this.$router.push("/list/"+this.searchVal)
//     },
 
  getcomments(){
       let data = Mock.mock({
           "list|7":[{
               authorName:"@cname",
               "comContent|30":"@cword",

           }]
       });
       this.comments= data.list
 },
  },
             //name:'CommentAdmin',
}






   // methods:{
   
   
//};



</script>

<style>

</style>

